package com.zhongkun.datahome.framework.aspectj;

import com.zhongkun.datahome.framework.config.TenantContext;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @Author: lifengsheng
 * @Date: 2025/5/7 15:32
 * @Desc
 */
@Aspect
@Component
public class TenantAspect {
    @Around("@annotation(com.zhongkun.datahome.common.annotation.IgnoreTenant)")
    public Object around(ProceedingJoinPoint point) throws Throwable {
        try {
            TenantContext.setIgnore(true);
            return point.proceed();
        } finally {
            TenantContext.clear();
        }
    }
}
